

function lego_set()
{
	var vertices = [
	10,  10,  10,   -10, -10,  10,   -10,  10, -10,    10, -10, -10
	];
	
	var vertices_2 = [
	110,  10,  10,   90, -10,  10,   90,  10, -10,    110, -10, -10
	];
	
	var indices = [
	2,  1,  0,    0,  3,  2,    1,  3,  0,    2,  3,  1
	];
	
	var add_piece = function (geometry, vertices, indices, color)
	{
		for ( var i = 0, l = vertices.length; i < l; i += 3 )
		{
			var v = new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] );
			geometry.vertices.push( v );
		}
		for ( var i = 0, l = indices.length; i < l; i += 3 )
		{
			var face = new THREE.Face3( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
			face.color = color;
			geometry.faces.push( face );
		}
	};
	this.material = new THREE.MeshLambertMaterial( { vertexColors: THREE.FaceColors, transparent: true } );

	this.geometry_1 = new THREE.Geometry();
	add_piece( this.geometry_1, vertices, indices, new THREE.Color( 0xAA0000 ) );
	this.geometry_1.computeFaceNormals();
	this.mesh_1 = function ()
	{
		return new THREE.Mesh(this.geometry_1.clone(), this.material.clone());
	}

	
	this.geometry_2 = new THREE.Geometry();
	add_piece( this.geometry_2, vertices_2, indices, new THREE.Color( 0x3333AA ) );
	this.geometry_2.computeFaceNormals();
	this.mesh_2 = function ()
	{
		return new THREE.Mesh(this.geometry_2.clone(), this.material.clone());
	}

	this.mesh_3 = function ()
	{
		var mesh = new THREE.Mesh(this.geometry_2.clone(), this.material.clone());
		mesh.translateZ(100);
		return mesh;
	}
	
	this.bones = [
	];
	
	this.bones.push(this.mesh_1());
	this.bones.push(this.mesh_2());
	this.bones.push(this.mesh_3());
	
	this.addBonesToGroup = function( group )
	{
		for ( var i = 0, l = this.bones.length; i < l; i += 1 )
		{
			group.add(this.bones[i]);
		}
	}
	
	this.highlight = function( number )
	{
		for ( var i = 0, l = this.bones.length; i < l; i += 1 )
		{
			var opacity = 1;
			if( i != number )
			{
				opacity = 0.2;
			}
			this.bones[i].material.opacity = opacity;
		}
	}
	
	this.clear_highlight = function()
	{
		for ( var i = 0, l = bones.length; i < l; i += 1 )
		{
			this.bones[i].material.opacity = 1;
		}
	}
	
}
